<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<script src="/statics/admin/js/My97DatePicker/WdatePicker.js"></script>
<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">订餐时间信息</h3>
    </div>
    <style>
        .panel-heading ul, .panel-heading ul li {
            float: left;
            list-style: none;
        }

        li .Wdate {
            height: 30px;
            width: 90px;
        }

        .panel-heading li {
            margin: 0 10px;
        }

        .panel-heading li, .panel-heading li select {
            height: 30px;
            line-height: 30px;
        }
    </style>
    <div class="panel-heading">
        <div class="form-group " >
            <div class= "row ">
                <%--<div class="col-sm-2">--%>
                 <%--订餐时间设置--%>
                <%--</div>--%>
                <div class="col-sm-1">开始时间</div>
                <div class="col-sm-2" >
                    <div class="input-group bootstrap-timepicker ">
                        <input type="text" class="form-control timepicker24" value = "${str1}" id="id1"/>
                        <span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
                    </div>
                </div>
                <div class="col-sm-1">结束时间</div>
                <div class="col-sm-2 ">
                    <div class="input-group bootstrap-timepicker ">
                        <input type="text" class="form-control timepicker24" value="${str2}" id="id2"/>
                        <span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
                    </div>
                </div>
                <div class="col-sm-1 col-sm-push-1" >
                    <button type="button" class="btn btn-danger" id="but1">设置</button>
                </div>
            </div>
        </div>
        <div class="form-group">
            &nbsp;&nbsp;&nbsp;&nbsp;主页时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="pageTime" class="Wdate" type="text" id="pag"
                       onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="时间设置" style="margin-top:10px;margin-left:5px"/>
            <button type="submit" class="btn btn-danger" id="butt" onclick="clik(this)">设置</button>
        </div>
    </div>
    <script type="text/javascript">
        function clik(th){
            var pg = $("#pag").val();
            if(pg==null || pg=='') {
                return;
            }else {
                json("/admin/pageUpdate.jspa", {"times":pg}, function (data) {
                    if(data.code==0){
                        layer.open({content:"修改成功",time:2});

                    }else{
                        layer.open({content:"修改失败",time:2});
                    }
                });
            }
        }
    </script>
    <script>
        $(function(){
            $("#but1").click(function(){
                var id1 = $("#id1").val();
                var id2 = $("#id2").val();
                if(id1=='' || id2=='' || id1==null || id2==null){
                    layer.open({content:"区域时间不能为空",time:1});
                    return;
                }
                json("/admin/updateArriveTimes.jspa", {beginTime:id1,endTime:id2}, function (data) {
                    layer.open({content:"订餐时间设置成功",time:2});
                    $("#id1").prop("value",id1);
                    $("#id2").prop("value",id2);
                })
            });
        })
    </script>
</div>